
Imports System.Data
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
#Region "using"
#End Region
Public Class LOAINGUOIDUNG_CHUCNANGDAO
    Inherits AbstractDAO
    Public Sub New(ByVal strPath As [String])
        MyBase.New(strPath)
    End Sub

    Public Function SelectAll() As DataSet
        Dim ds As DataSet
        Try
            ds = New DataSet()
            MyBase.sql = "usp_LOAINGUOIDUNG_CHUCNANG_SelectAll"
            MyBase.FillDataSet(ds, "LOAINGUOIDUNG_CHUCNANG")
            Return ds
        Catch e As System.Exception
            Throw New Exception(e.Message, e.InnerException)
        Finally
            MyBase.CleanUpObject()
        End Try
    End Function

    Public Function SelectByID(ByVal id As Integer) As DataSet
        Dim ds As DataSet
        Try
            ds = New DataSet()
            MyBase.sql = "usp_LOAINGUOIDUNG_CHUCNANG_SelectByID"
            MyBase.InitializeCommand()
            MyBase.AddParameter("@ID", SqlDbType.Int, 1000, id)
            MyBase.FillDataSet(ds, "LOAINGUOIDUNG_CHUCNANG")
            Return ds
        Catch e As System.Exception
            Throw New Exception(e.Message, e.InnerException)
        Finally
            MyBase.CleanUpObject()
        End Try
    End Function

    Public Function Insert(ByVal obj As LOAINGUOIDUNG_CHUCNANGDTO) As Boolean
        Try
            MyBase.sql = "usp_LOAINGUOIDUNG_CHUCNANG_Insert"
            MyBase.InitializeCommand()
            MyBase.AddParameter("@IDChucNang", SqlDbType.Int, 1000, obj.IDChucNang)
            MyBase.AddParameter("@IDLoaiNguoiDung", SqlDbType.Int, 1000, obj.IDLoaiNguoiDung)
            Return ExecuteStoredProcedure()
        Catch
            Return False
        End Try
    End Function

    Public Function Update(ByVal obj As LOAINGUOIDUNG_CHUCNANGDTO) As Boolean
        Try
            MyBase.sql = "usp_LOAINGUOIDUNG_CHUCNANG_Update"
            MyBase.InitializeCommand()
            MyBase.AddParameter("@ID", SqlDbType.Int, 1000, obj.ID)
            MyBase.AddParameter("@IDChucNang", SqlDbType.Int, 1000, obj.IDChucNang)
            MyBase.AddParameter("@IDLoaiNguoiDung", SqlDbType.Int, 1000, obj.IDLoaiNguoiDung)
            Return ExecuteStoredProcedure()
        Catch
            Return False
        End Try
    End Function

    Public Function Delete(ByVal id As Integer) As Boolean
        Try
            MyBase.sql = "usp_LOAINGUOIDUNG_CHUCNANG_Delete"
            MyBase.InitializeCommand()
            MyBase.AddParameter("@ID", SqlDbType.Int, 1000, id)
            Return ExecuteStoredProcedure()
        Catch
            Return False
        End Try
    End Function

    Public Function SelectByIDChucNang(ByVal idchucnang As Integer) As DataSet
        Dim ds As DataSet
        Try
            ds = New DataSet()
            MyBase.sql = "usp_LOAINGUOIDUNG_CHUCNANG_SelectByIDChucNang"
            MyBase.InitializeCommand()
            MyBase.AddParameter("@IDChucNang", SqlDbType.Int, 1000, idchucnang)
            MyBase.FillDataSet(ds, "LOAINGUOIDUNG_CHUCNANG")
            Return ds
        Catch e As System.Exception
            Throw New Exception(e.Message, e.InnerException)
        Finally
            MyBase.CleanUpObject()
        End Try
    End Function

    Public Function SelectByIDLoaiNguoiDung(ByVal idloainguoidung As Integer) As DataSet
        Dim ds As DataSet
        Try
            ds = New DataSet()
            MyBase.sql = "usp_LOAINGUOIDUNG_CHUCNANG_SelectByIDLoaiNguoiDung"
            MyBase.InitializeCommand()
            MyBase.AddParameter("@IDLoaiNguoiDung", SqlDbType.Int, 1000, idloainguoidung)
            MyBase.FillDataSet(ds, "LOAINGUOIDUNG_CHUCNANG")
            Return ds
        Catch e As System.Exception
            Throw New Exception(e.Message, e.InnerException)
        Finally
            MyBase.CleanUpObject()
        End Try
    End Function

End Class
